package org.huatek.anders.service;

import com.alibaba.dubbo.config.annotation.Service;
import org.huatek.anders.entity.OrderEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author anders
 * @date 2018-11-16 14:51
 **/
@Component
@Service
@Slf4j
public class RefundNotifySenderServiceImpl implements RefundNotifySenderService {

    private final RabbitTemplate rabbitTemplate;
    @Autowired
    public RefundNotifySenderServiceImpl(RabbitTemplate rabbitTemplate){
        this.rabbitTemplate = rabbitTemplate;
    }

    @Override
    public void sender(OrderEntity order){
        log.info("notify.refund send message: "+order);
        rabbitTemplate.convertAndSend("notify.refund", order);
    }

}
